//
//  CarlatestInfoModel.m
//  CarProjectTest
//
//  Created by lanou on 15/10/24.
//  Copyright © 2015年 完美的宇gogo. All rights reserved.
//

#import "CarlatestInfoModel.h"
#import "CarLatest_newsListModel.h"
#import "CarLatest_newsHotModel.h"

@implementation CarlatestInfoModel

-(void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}


-(void)setValue:(id)value forKey:(NSString *)key
{
    if ([key isEqualToString:@"focusList"])
    {
        _focusList = [[CarLatest_focusListModel alloc]init];
        [_focusList setValuesForKeysWithDictionary:value];
    }
    else if ([key isEqualToString:@"newsList"])
    {
        _newsList = [NSMutableArray array];
        for (NSDictionary *dic in value)
        {
            // 判断字典是否包含key值 adIndex
            if ([[dic allKeys] containsObject:@"adIndex"])
            {
                CarLatest_newsHotModel *model = [[CarLatest_newsHotModel alloc]init];
                [model setValuesForKeysWithDictionary:dic];
                [_newsList addObject:model];
            }
            else
            {
                CarLatest_newsListModel *model = [[CarLatest_newsListModel alloc]init];
                [model setValuesForKeysWithDictionary:dic];
                [_newsList addObject:model];
            }
        }
    }
    else
    {
        [super setValue:value forKey:key];
    }
}






@end
